<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>RestConf Documentation</title>
  <link rel="stylesheet" type="text/css" href="./css/swagger-ui.css" >
  <link rel="icon" type="image/png" href="./images/favicon-32x32.png" sizes="32x32" />
  <link rel="icon" type="image/png" href="./images/favicon-16x16.png" sizes="16x16" />
  <style>
      html
      {
        box-sizing: border-box;
        overflow: -moz-scrollbars-vertical;
        overflow-y: scroll;
      }

      *,
      *:before,
      *:after
      {
        box-sizing: inherit;
      }

      body
      {
        margin:0;
        background: #fafafa;
      }

      topbar-wrapper img {
        content:url('images/logo_small.png');
      }
    </style>
</head>

<body>
<div id="swagger-ui"></div>

<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<script src="./js/swagger-ui-bundle.js"> </script>
<script>
    window.onload = function() {
      var xmlHttp = new XMLHttpRequest();
      xmlHttp.open("GET", document.URL.split('/apidoc')[0] + "/apidoc/openapi3/18/apis/mounts", false);
      xmlHttp.send( null );

      var base_url_rfc = document.URL.split('/apidoc')[0] + '/apidoc/openapi3/18/apis/mounts/';
      var base_url_draft = document.URL.split('/apidoc')[0] + '/apidoc/openapi3/apis/mounts/';
      var swagger_urls = [{url: document.URL.split('/apidoc')[0] + "/apidoc/openapi3/18/apis/single", name: "Controller resources - RestConf RFC 8040"},
                          {url: document.URL.split('/apidoc')[0] + "/apidoc/openapi3/apis/single", name: "Controller resources - RestConf draft02"}];
      var devices = JSON.parse(xmlHttp.responseText);
      for (var i =0; i < devices.length; i++) {
        var device_name = devices[i]['instance'].split('=')[1].replace('/', '');
        var dveice_id = devices[i]['id'];
        var dict = {
          url: base_url_rfc + dveice_id,
          name: device_name + " resources - RestConf RFC 8040",
        };
        swagger_urls.push(dict);
        var dict = {
          url: base_url_draft + dveice_id,
          name: device_name + " resources - RestConf draft02",
        };
        swagger_urls.push(dict);
      }

      // Begin Swagger UI call region
      const ui = SwaggerUIBundle({
        urls: swagger_urls,
        dom_id: '#swagger-ui',
        docExpansion: 'none',
        deepLinking: true,
        showAlternativeSchemaExample: true,
        onComplete: function(swaggerApi, swaggerUi){
	      var wrappers = document.getElementsByClassName('wrapper');
	      for(var i = 0; i < wrappers.length; i++) {
            if (wrappers[i].innerText === "Schemas") {
              wrappers[i].remove();
              break;
            }
          }
          var topbar = document.getElementsByClassName('topbar-wrapper');
          var node2 = document.createElement("H2");
          var node = document.createElement("IMG");
          node.height = 40;
          node.src = 'images/logo_small.png';
          node2.innerText = "OpenDaylight RestConf API Documentation";
          node2.prepend(node);
          topbar[0].children[0].remove();
          topbar[0].prepend(node2);
          node.style = "padding-right: 18px;";
          topbar[0].children[0].style="color:white; display: contents;";

          var modules = document.getElementsByClassName('opblock-tag-section')
          for(var i = 0; i < modules.length; i++) {
            var innerText = modules[i].getElementsByTagName('a')[0].innerText;
            var arrayInnerText = innerText.split(' ')
            if (arrayInnerText.length > 0) {
              modules[i].getElementsByTagName('a')[0].innerText = arrayInnerText[arrayInnerText.length - 1];
            }
          }
          document.getElementsByClassName("select-label")[0].style = "max-width: max-content; padding-left: 20px";
          document.getElementById("select").style = "flex: 0"
        },
        presets: [
          SwaggerUIBundle.presets.apis,
          SwaggerUIStandalonePreset
        ],
        plugins: [
          SwaggerUIBundle.plugins.DownloadUrl
        ],
        layout: "StandaloneLayout"
      })
      // End Swagger UI call region

      window.ui = ui

    }

  </script>
<script src="./js/swagger-ui-standalone-preset.js"> </script>
</body>
</html>




